<template>
    <div style="width: 60%" class="ctbox">
        <div id="icd_history">
            <el-timeline>
                <el-timeline-item
                        v-for="(icd, index) in icds"
                        :key="index"
                        :timestamp="icd.editTime"
                        :placement="top"
                >
                    <el-row>
                        <el-col :span="11">
                            <el-card>
                                <div slot="header">
                                    <span>{{icd.editType}}信息</span>
                                </div>
                                <el-form label-position="right" label-width="80px">
                                    <el-form-item label="修改表">
                                        <el-tag type="success" effect="dark">ICD表</el-tag>
                                    </el-form-item>
                                    <el-form-item label="修改人">
                                        <el-tag >{{icd.editBy}}</el-tag>
                                    </el-form-item>
                                    <el-form-item label="修改方式">
                                        <el-tag type="danger" effect="dark">{{icd.editType}}</el-tag>
                                    </el-form-item>
                                </el-form>
                            </el-card>
                        </el-col>
                        <el-col :span="11" :offset="1">
                            <el-card style="height: 280px">
                                <div slot="header">
                                    <span>{{icd.editType}}前</span>
                                    <el-button style="float: right; padding: 3px 0" type="text" @click="rollback(icd.id)">回溯</el-button>
                                </div>
                                <el-descriptions direction="vertical" :column="4" border>
                                    <el-descriptions-item label="ICD编码">{{icd.icdCode}}</el-descriptions-item>
                                    <el-descriptions-item label="ICD名称">{{icd.name}}</el-descriptions-item>
                                    <el-descriptions-item label="ICD版本">{{icd.typeid}}</el-descriptions-item>
                                </el-descriptions>
                            </el-card>
                        </el-col>
                    </el-row>
                </el-timeline-item>
            </el-timeline>
        </div>
    </div>
</template>

<script>
    export default {
        name: "HistoryView",
        methods:{
            page(currentPage){
                const _this = this;
                axios.get('http://127.0.0.1:8081/ICDManagement/code/historyQuery/'+currentPage+'/5').then(function (res) {
                    _this.currentPage=currentPage;
                    _this.total=parseInt(res.data.total);
                    _this.icds=res.data.data;
                });
            },
            rollback(id){
                alert(id);
            }
        },
        created() {
            this.page(1);
        },
        data() {
            return {
                icds: [{
                    id:'a1abc376e92940428e2767aa4fe3ffb7',
                    icdCode:'0a01',
                    name:'222',
                    typeid:'ICD-10疾病编码',
                    editBy:'张三',
                    editType:'更新',
                    editTime:'2022-05-30 14:47:05'
                }]
            };
        }
    }
</script>

<style scoped>
    .ctbox{ margin:0 auto;}
</style>